package org.example.Test1;

import java.util.Scanner;

public class Test {
    static int k1 = 0;
    static int k2= 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String in = sc.nextLine();
        String[] res = in.split(",");
        int[]num = new int[100];
        char[]ops = new char[100];
        for (int i = 0; i < res.length; i++) {
            char[]ch = res[i].toCharArray();
            if(ch.length==1&&((ch[0]=='+')||(ch[0]=='-')||(ch[0]=='*')||(ch[0]=='/'))){
                ops[k2++]=ch[0];
                int newnum = calc(num,ops);
                num[k1++] = newnum;
            }else{
                num[k1++]=Integer.parseInt(res[i]);
            }
        }
        System.out.println("结果为"+ num[0]);
    }

    private static int calc(int[] num, char[] ops) {
        int num1 = num[--k1];
        int num2 = num[--k1];
        char ch  = ops[--k2];
        if(ch=='+'){
            return num1+num2;
        }else if(ch=='-'){
            return num2-num1;
        }else if (ch=='*'){
            return num1*num2;
        }else{
            return num2/num1;
        }
    }
}
